package com.ply.controller;

import com.ply.pojo.Permission;
import com.ply.pojo.User;
import com.ply.service.PermissionService;
import com.ply.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@RequestMapping("/user")
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @Autowired
    private PermissionService permissionService;

    //查询所有用户
    @ResponseBody
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public List<User> findList() {
        return userService.findList();
    }

    //查询用户的权限
    @ResponseBody
    @RequestMapping(value = "/per",method = RequestMethod.GET)
    public List<Permission> findPerList(String username) {
        return permissionService.findPermissionByUsername(username);
    }


}
